package com.wpt.main.constant;

import java.util.HashMap;
import java.util.Map;

/**
 *  所有文件类型枚举
 *  @author  xinqh
 *  @Date    2011-3-31 下午03:06:20
 */
public class FilesType {

	private static final Map<String,String> ftMap = new HashMap<String,String>();
	
	private static final Map<String,String> fpMap = new HashMap<String,String>();
	
	static{
		
		/*电影类*/
		ftMap.put(".avi","avi 文件");
		ftMap.put(".rm","rm 文件");
		ftMap.put(".rmvb","rmvb 文件");
		ftMap.put(".mp4","mp4 文件");
		ftMap.put(".wmv","wmv 文件");
		ftMap.put(".mov","mov 文件");
		ftMap.put(".mkv","mkv 文件");
		ftMap.put(".divx","divx 文件");
		ftMap.put(".3gp","3pg 文件");
		
		/*图片类*/
		ftMap.put(".jpg","jpg 图片");
		ftMap.put(".jpeg","jpeg 图片");
		ftMap.put(".gif","gif 图片");
		ftMap.put(".bmp","bmp 图片");
		ftMap.put(".ico","ico 图片");
		ftMap.put(".png","png 图片");
		ftMap.put(".tif","tif 图片");		
		
		/*音乐类*/
		ftMap.put(".mp3","mp3 音乐文件");
		ftMap.put(".wma","wma 音乐文件");
		ftMap.put(".mid","mid 音乐文件");
		
		/*压缩文件类*/
		ftMap.put(".zip","zip 压缩文件");
		ftMap.put(".rar","rar 压缩文件");
		ftMap.put(".7z","7z 压缩文件");
		
		/*office类*/
		ftMap.put(".doc","word 文档");
		ftMap.put(".docx","word 文档");
		ftMap.put(".xls","excel 文档");
		ftMap.put(".xlsx","excel 文档");
		ftMap.put(".ppt","powerpoint 文档");
		ftMap.put(".pptx","powerpoint 文档");
		
		/*普通文本txt*/
		ftMap.put(".txt","txt 文本");
		
		/*pdf*/
		ftMap.put(".pdf","adobe PDF 文件");
		
		/*应用程序类exe*/
		ftMap.put(".exe","应用程序");
		
		/*文件夹*/
		ftMap.put("folder", "文件夹");
	}
	
	static{
		/*电影类*/
		fpMap.put(".avi","movie.png");
		fpMap.put(".rm","movie.png");
		fpMap.put(".rmvb","movie.png");
		fpMap.put(".mp4","movie.png");
		fpMap.put(".wmv","movie.png");
		fpMap.put(".mov","movie.png");
		fpMap.put(".mkv","movie.png");
		fpMap.put(".divx","movie.png");
		fpMap.put(".3gp","movie.png");
		
		/*图片类*/
		fpMap.put(".jpg","image.png");
		fpMap.put(".jpeg","image.png");
		fpMap.put(".gif","image.png");
		fpMap.put(".bmp","image.png");
		fpMap.put(".ico","image.png");
		fpMap.put(".png","image.png");
		fpMap.put(".tif","image.png");		
		
		/*音乐类*/
		fpMap.put(".mp3","music.png");
		fpMap.put(".wma","music.png");
		fpMap.put(".mid","music.png");
		
		/*压缩文件类*/
		fpMap.put(".zip","zip.png");
		fpMap.put(".rar","zip.png");
		fpMap.put(".7z","zip.png");
		
		/*office类*/
		fpMap.put(".doc","word.png");
		fpMap.put(".docx","word.png");
		fpMap.put(".xls","excel.png");
		fpMap.put(".xlsx","excel.png");
		fpMap.put(".ppt","powerpoint.png");
		fpMap.put(".pptx","powerpoint.png");
		
		/*普通文本txt*/
		fpMap.put(".txt","txt.png");
		
		/*pdf*/
		fpMap.put(".pdf","pdf.png");
		
		/*应用程序类exe*/
		fpMap.put(".exe","application.png");
		
		/*文件夹*/
		fpMap.put("folder", "folder.png");
	}
	
	public static String getFileIcon(String suffix){
		String str = fpMap.get(suffix.toLowerCase());
		if(str == null){
			return "assets/image/icon/unknow.png";
		}
		return "assets/image/icon/"+str;
	}
	
	public static String getFileType(String suffix){
		String str = ftMap.get(suffix.toLowerCase());
		if(str == null){
			return "其它";
		}
		return str;
	}
}
